import { addStudentAPI, studentAPI } from "@/api/students";

export default {
  namespaced: true,
  state: {
    sList: [],
  },
  getters: {},
  mutations: {
    studentsList(state, data) {
      state.sList = data;
      // console.log(state.sList);
    },
    // 关闭表单，清空数据
    clearForm(state) {},
  },
  actions: {
    async initDataJs(context) {
      const res = await studentAPI();
      // console.log(res.data.data);
      context.commit("studentsList", res.data.data);
    },
    async addStudent(context, form) {
      const res = await addStudentAPI(form);
      console.log(res);
    },
  },
};
